package com.book.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.book.mapper.BookDao;
import com.book.model.Book;
import com.book.model.BookFree;
import com.book.mapper.BookFreeDao;
import com.book.service.BookFreeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wx
 * @since 2023-10-13 10:57:31
 */
@Service
public class BookFreeServiceImpl extends ServiceImpl<BookFreeDao, BookFree> implements BookFreeService {

    @Autowired
    private RedisTemplate redisTemplate;

    @Autowired
    private BookFreeDao bookFreeDao;

    @Autowired
    private BookDao bookDao;

    @Override
    public void redisHost() {
        QueryWrapper<Book> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("free","2");
        List<Book> bookList = bookDao.selectList(queryWrapper);
        bookList.stream().map((x)->{
            return x;
        }).forEach((y)->{
            y.getId();
        });
    }
}
